<!DOCTYPE html>  
<html lang="zh">  
<head>  
    <meta charset="UTF-8">  
    <meta name="viewport" content="width=device-width, initial-scale=1.0">  
    <title>语音播报</title>  
    <style>  
        body {  
            font-family: Arial, sans-serif;  
            margin: 0;  
            padding: 0;  
        }  
  
        .container { 
            width: 100%; 
            display: flex;  
            flex-direction: column;  
            align-items: center;  
            /*justify-content: center;  */
            height: 100vh;  
            padding: 20px;
            margin-top: 50px; 
        }  
  
        .text-input {  
            width: 80%;  
            padding: 10px;  
            font-size: 16px;  
            border: 1px solid #ccc;  
            border-radius: 5px;
            margin: auto;
            margin-top: 20px;  
            margin-bottom: 20px;
            text-align: center;  
        }  
  
        .button-group {  
            /* display: flex;   */
            /* flex-wrap: wrap;   */
            width: 90%;
            justify-content: space-between;
            margin-top: 10px;   
        }  
  
        .button-group button {  
            width: 80%;  
            padding: 10px;  
            font-size: 16px;  
            border: none;  
            border-radius: 5px;  
            background-color: #4CAF50;  
            color: #fff;  
            cursor: pointer; 
            display:block;
            margin: auto;
            margin-top: 20px
        }  
  
        .button-group button:hover {  
            background-color: #45a049;  
        }  
  
        /* 适配小屏幕设备 */  
        /*@media screen and (max-width: 600px) {  
            .button-group button {  
                width: 100%;  
                margin-bottom: 10px;  
            }  
        }  */
    </style> 
</head>  
<body>  
    <div class="container">  
        <input type="text" class="text-input" id="text-input" placeholder="请输入文本">  
        <div class="button-group">  
            <button onclick="handleClick('')">公告</button>
            <button onclick="handleClick('公安窗口')">公安窗口</button> 
            <button onclick="handleClick('综合受理窗口')">综合窗口</button>
            <button onclick="handleClick('人社医保一窗口')">人社医保①</button>
            <button onclick="handleClick('人社医保二窗口')">人社医保②</button>
        </div>  
    </div> 
    <script>
        function handleClick(windows_name) {
            var input_text = document.getElementById("text-input").value;
            if(input_text.length == 0){
                alert("请输入内容！");
            }
            else{
                var xhr = new XMLHttpRequest();
                if(windows_name.length > 0){
                    var notice_text = "请" + input_text + "到" + windows_name +"办理业务";
                    // alert(notice_text);
                    xhr.open("GET", "http://192.168.0.105:9000/index/"+notice_text+"/", true);                   
                }
                else{
                    var notice_text = input_text;
                    // alert(notice_text);
                    xhr.open("GET", "http://192.168.0.105:9000/index/"+notice_text+"/", true);
                }
                xhr.onreadystatechange = function() {  
                    if (xhr.readyState == 4 && xhr.status == 200) {  
                        var response = xhr.responseText;  
                        console.log(response);  
                    }  
                };  
                xhr.send(); 
            }

        }
    </script> 
</body>  
</html>